#include "Share.h"

Allocator::Allocator( Allocator_Impl *impl )
	: impl_( impl )
{
	if( !impl_ )
		impl_ = new Allocator_Cache<SpinLock> ( );
}

Allocator::~Allocator( void )
{
	clear( );
}

Allocator_Impl * Allocator::impl( ) const
{
	return this->impl_;
}

void Allocator::impl( Allocator_Impl *impl )
{
	if( !impl )
		return;

	if( impl_ )
		delete impl_;

	impl_ = impl;
}

void Allocator::clear( )
{
	if( impl_ )
		delete impl_;
}